package view;

import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;

import util.LogUtil;

/**
 *  Created by liuxiaobin on 2017/3/23
 *  MySwipeRefreshLayout 只处理 在头部时的事件
 */

public class MySwipeRefreshLayout extends SwipeRefreshLayout {

    public MySwipeRefreshLayout(Context context) {
        super(context);
    }

    public MySwipeRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                break;

            case MotionEvent.ACTION_MOVE:
                if (!SmartScrollView.isScrolledToTop) {
                    return false;  //返回false就让子view自己处理
                }
        }

        return super.onInterceptTouchEvent(event);
    }

}
